//
//  NYSettingForm.m
//  NiuWaJiaoYu
//
//  Created by MinLison on 2017/12/25.
//  Copyright © 2017年 niuwaketang. All rights reserved.
//

#import "NYSettingForm.h"
#import "NYMineForm.h"
#import "NYSetPwdViewController.h"
#import "NYMyConsumeRecordViewController.h"
#import "NYMyVipViewController.h"

#import "NYAgreementViewController.h"

@implementation NYSettingForm
- (instancetype)initWithTitle:(NSString *)title
{
        self = [super initWithTitle:title];
        if (self) {
                [self initializeForm];
        }
        return self;
}
- (void)initializeForm
{
        __block XLFormSectionDescriptor * section;
        __block XLFormRowDescriptor * row;
        UITableViewCell *cell;
        
        section = [XLFormSectionDescriptor formSectionWithTitle:@"setting"];
        [self addFormSection:section];
        
        NSArray <NSString *>*normalCellTitles = @[@"修改密码",
                                                  @"VIP信息",
                                                  @"消费记录",
                                                  @"服务协议",
                                                  ];
        NSArray <Class>*normalCellTargetClass = @[[NYSetPwdViewController class],
                                                  [NYMyVipViewController class],
                                                  [NYMyConsumeRecordViewController class],
                                                  [NYAgreementViewController class]
                                                  ];
        [normalCellTitles enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
               
                row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:NYMineFormRowDescriptorTypeCustom title:obj];
                row.cellClass = [NYMineNormalCell class];
                row.height = __WGHeight(45);
                row.opaque = @(1); /// 需要登录
                row.action.viewControllerPresentationMode = XLFormPresentationModePush;
                [row.cellConfig setObject:@(UITableViewCellSelectionStyleNone) forKey:@keypath(cell,selectionStyle)];
                row.action.viewControllerClass = normalCellTargetClass[idx];
                [section addFormRow:row];
        }];
}
@end
